package cn.portx.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.annotation.ChineseField;
import cn.portx.policy.ChineseToCodeGeneratorPolicy;
import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

/**
 * Model class of 车辆.
 * 
 * @author generated by ERMaster
 * @version $Id$
 */
@Entity
@Table(name = "T_CAR")
public class Car extends BaseEntity {

	/** serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** 车牌号. */
	@Column(name = "NO_", length = 15)
	@PropertyDef(label = "车牌号", description = "车牌号:车牌号")
	private String no;

	/** 所属车队ID. */
	@Column(name = "FLEET_ID_", length = 60)
	@PropertyDef(label = "所属车队ID", description = "所属车队ID:所属车队ID")
	private String fleetId;

	@Transient
	private Fleet fleet;

	/** 司机姓名. */
	@Column(name = "NAME_", length = 20)
	@PropertyDef(label = "司机姓名", description = "司机姓名:司机姓名")
	private String name;

	/** 司机代码. */
	@Column(name = "CODE_", length = 10)
	@ChineseField("name")
	@Generator(policy = ChineseToCodeGeneratorPolicy.class)
	@PropertyDef(label = "司机代码", description = "司机代码:司机代码")
	private String code;

	/** 身份证号. */
	@Column(name = "ID_CARD_", length = 20)
	@PropertyDef(label = "身份证号", description = "身份证号:身份证号")
	private String idCard;

	/** 联系电话. */
	@Column(name = "TEL_", length = 20)
	@PropertyDef(label = "联系电话", description = "联系电话:联系电话")
	private String tel;

	/** 邮箱. */
	@Column(name = "MAIL_", length = 60)
	@PropertyDef(label = "邮箱", description = "邮箱:邮箱")
	private String mail;

	/** 住址. */
	@Column(name = "ADDRESS_", length = 200)
	@PropertyDef(label = "住址", description = "住址:住址")
	private String address;

	/** 备注. */
	@Column(name = "REMARK_", length = 300)
	@PropertyDef(label = "备注", description = "备注:备注")
	private String remark;

	/**
	 * Constructor.
	 */
	public Car() {
	}

	/**
	 * Set the 车牌号.
	 * 
	 * @param no
	 *            车牌号
	 */
	public void setNo(String no) {
		this.no = no;
	}

	/**
	 * Get the 车牌号.
	 * 
	 * @return 车牌号
	 */
	public String getNo() {
		return this.no;
	}

	/**
	 * Set the 所属车队ID.
	 * 
	 * @param fleetId
	 *            所属车队ID
	 */
	public void setFleetId(String fleetId) {
		this.fleetId = fleetId;
	}

	/**
	 * Get the 所属车队ID.
	 * 
	 * @return 所属车队ID
	 */
	public String getFleetId() {
		return this.fleetId;
	}

	public Fleet getFleet() {
		return fleet;
	}

	public void setFleet(Fleet fleet) {
		this.fleet = fleet;
	}

	/**
	 * Set the 司机姓名.
	 * 
	 * @param name
	 *            司机姓名
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Get the 司机姓名.
	 * 
	 * @return 司机姓名
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Set the 司机代码.
	 * 
	 * @param code
	 *            司机代码
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * Get the 司机代码.
	 * 
	 * @return 司机代码
	 */
	public String getCode() {
		return this.code;
	}

	/**
	 * Set the 身份证号.
	 * 
	 * @param idCard
	 *            身份证号
	 */
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	/**
	 * Get the 身份证号.
	 * 
	 * @return 身份证号
	 */
	public String getIdCard() {
		return this.idCard;
	}

	/**
	 * Set the 联系电话.
	 * 
	 * @param tel
	 *            联系电话
	 */
	public void setTel(String tel) {
		this.tel = tel;
	}

	/**
	 * Get the 联系电话.
	 * 
	 * @return 联系电话
	 */
	public String getTel() {
		return this.tel;
	}

	/**
	 * Set the 邮箱.
	 * 
	 * @param mail
	 *            邮箱
	 */
	public void setMail(String mail) {
		this.mail = mail;
	}

	/**
	 * Get the 邮箱.
	 * 
	 * @return 邮箱
	 */
	public String getMail() {
		return this.mail;
	}

	/**
	 * Set the 住址.
	 * 
	 * @param address
	 *            住址
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * Get the 住址.
	 * 
	 * @return 住址
	 */
	public String getAddress() {
		return this.address;
	}

	/**
	 * Set the 备注.
	 * 
	 * @param remark
	 *            备注
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * Get the 备注.
	 * 
	 * @return 备注
	 */
	public String getRemark() {
		return this.remark;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Car other = (Car) obj;
		if (this.getId() == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!this.getId().equals(other.getId())) {
			return false;
		}
		return true;
	}

}
